<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div style='width:600px;height:400px'></div>
  <script src='https://cdnjs.cloudflare.com/ajax/libs/echarts/4.8.0/echarts.min.js'></script>
  <script>
    var xDataArr = ['张三', '里斯', '王五', '老刘', '老王', '小五', '小刘', '大熊']
    var yDataArr1 = [32, 32, 3, 23, 25, 23, 22, 102]
    var yDataArr2 = [93, 60, 87, 99, 23, 0, 10, 2]
    var mycharts = echarts.init(document.querySelector('div'))
    var option = {
      title: {
        text: '成绩单',
        textStyle: {
          color: 'black'
        }
      },
      toolbox: {
        feature: {
          dataZoom: {}
        }
      },
      legend: {
        data: ['语文', '数学']
      },
      xAxis: {
        type: 'category',
        data: xDataArr,
      },
      yAxis: {
        type: 'value',
      },
      series: [
        {
          name: '语文',
          type: 'bar',
          data: yDataArr1,
        },
        {
          name: '数学',
          type: 'bar',
          data: yDataArr2
        }
      ],
    }
    mycharts.setOption(option)
  </script>
</body>

</html>